/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ivanbiz.buku;

import java.util.List;

/**
 *
 * @author User
 */
public class BukuServiceImpl implements BukuService{
    private BukuDAO bukuDAO;

    public void setBukuDAO(BukuDAO bukuDAO) {
        this.bukuDAO = bukuDAO;
    }
    
    public void saveBuku(Buku buku) throws Exception {
        this.bukuDAO.save(buku);
    }

    public void deleteBuku(Buku buku) throws Exception {
        this.bukuDAO.delete(buku);
    }

    public void updateBuku(Buku buku) throws Exception {
        this.bukuDAO.update(buku);
    }

    public List loadAll() throws Exception {
        return this.bukuDAO.getAll(Buku.class);
    }

    public Buku loadById(long id) throws Exception {
        return (Buku)this.bukuDAO.load(Buku.class, id);
    }

    public boolean cekIsEmptyKode(String kode) throws Exception {
        return this.bukuDAO.cekIsEmptyKode(kode);
    }

    public boolean cekFlagBuku(String kode, String flag) throws Exception {
        return this.bukuDAO.cekFlagBuku(kode, flag);
    }

    public Buku loadByKode(String kode) throws Exception {
        return (Buku)this.bukuDAO.getDataByEqual(Buku.class, "kodeBuku", kode);
    }

    public List cariBuku(String nama, String flag) throws Exception {
        return this.bukuDAO.cariBuku(nama, flag);
    }
    
    
}
